package leetcode.秋招.小米;

import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/9/1 19:52
 * @description：
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int p = 0;
        for (int i = 1; i <= n; i++) {
            p = (p + 3) % i;
        }
        System.out.println(p + 1);
    }
}
